const net = require('net');

const client = net.connect({
  port: 3000
});

client.on('data', data => {
  console.log(data.toString());
})

// 客户端发送消息
client.write('client')